import NP from 'number-precision'

// 减法函数
function accSubtr(arg1, arg2) {
  if (arg2) {
    return arg1 - arg2
  } else {
    return arg1 - 0
  }
}
//根据商品编号生成动态更新的库存
function gen_kc() {

}
export const columns = [
  {
    title: "序号",
    dataIndex: "index",
    key: "index",
    width: 45,
    align: 'center',
    customRender: (value, item, index) => {
      return item.isTotal ? "合计" : index + 1;
    },
  },
  {
    title: "品名",
    dataIndex: "name",
    key: "name",
    width: 80,
    align: 'center',
  },
  {
    title: "型号尺寸",
    dataIndex: "specification",
    key: "specification",
    width: 80,
    align: 'center',
    scopedSlots: { customRender: "specification" },
  },
  {
    title: '件数',
    dataIndex: 'quantity',
    key: 'quantity',
    width: 40,
    align: 'center',
    scopedSlots: { customRender: "quantity" },
  },
  {
    title: "材料费",
    dataIndex: "clf",
    key: "clf",
    align: 'center',
    children: [
      {
        title: "单重",
        dataIndex: "unit_weight",
        key: "unit_weight",
        width: 100,
        align: 'center',
        scopedSlots: { customRender: "unit_weight" },
      },
      {
        title: "总重量",
        dataIndex: "total_weight",
        key: "total_weight",
        width: 70,
        align: 'center',
      },
      {
        title: "单价",
        dataIndex: "material_unit_price",
        key: "material_unit_price",
        width: 40,
        align: 'center',
        scopedSlots: { customRender: "material_unit_price" },
      },
      {
        title: "金额(元)",
        dataIndex: "material_amount",
        key: "material_amount",
        width: 70,
        align: 'center',
        customRender: (value, item) => {
          if (item.isTotal) return value;
          value = NP.times(item.total_weight, item.material_unit_price);
          item.material_amount=value
          return item.id ? NP.round(value, 2) : "";
        },
      },
    ],
  },
  {
    title: "烫工费",
    dataIndex: "jgf",
    key: "jgf",
    align: 'center',
    children: [
      {
        title: "单条数",
        dataIndex: "unit_strip_count",
        key: "unit_strip_count",
        width: 100,
        align: 'center',
        scopedSlots: { customRender: "unit_strip_count" },
      },
      {
        title: "总条数",
        dataIndex: "total_strip_count",
        key: "total_strip_count",
        width: 60,
        align: 'center',        
      },
      {
        title: "单价",
        dataIndex: "ironing_unit_price",
        key: "ironing_unit_price",
        width: 40,
        align: 'center',
        scopedSlots: { customRender: "ironing_unit_price" },
      },
      {
        title: "金额(元)",
        dataIndex: "ironing_amount",
        key: "ironing_amount",
        width: 80,
        align: 'center',
        customRender: (value, item) => {
          if (item.isTotal) return value;
          value = NP.times(item.total_strip_count, item.ironing_unit_price);
          item.ironing_amount=value
          return item.id ? NP.round(value, 2) : "";
        },
      },
    ]
  },
  {
    title: "总金额(元)",
    dataIndex: "total_amount",
    key: "total_amount",
    width: 80,
    align: 'center',
    customRender: (value, item) => {
      if (item.isTotal) return value;
      value = NP.times(item.total_weight, item.material_unit_price) +
        NP.times(item.total_strip_count, item.ironing_unit_price);
      item.total_amount=value
      return item.id ? NP.round(value, 2) : "";
    },
  },
  {
    title: "备注",
    dataIndex: "notes",
    key: "notes",
    width: 80,
    align: 'center',
    scopedSlots: { customRender: "notes" },
  },
  {
    title: "操作",
    dataIndex: "action",
    key: "action",
    width: 60,
    align: 'center',
    scopedSlots: { customRender: "action" },
  },
];
export var canshu = {
  is_dagong_table: false,//是否用大工表格格式，true代表是，false代表否
  yongliaojl: true,//用料计量，true表示用重量计量，false表示用面积计量
  midu: 7.85,//钢材密度
  xishu: 1.05//损耗系数
}
//计算重量
export function calzhong_dg(c, k, h) {
  let v = 0
  if (c && k && h) {
    v = NP.times(parseFloat(c), parseFloat(k), parseFloat(h), canshu.midu, canshu.xishu) / 1000000;
  }
  return v
}
//计算面积
export function calmianji_dg(c, k) {
  let v = 0
  if (c && k) {
    v = NP.times(c, k) / 10000;
  }
  return v
}
//计算用料金额
//c,k,h,z,mj,dj对应长、宽、厚、重、面积、单价
export function calclAmount(c, k, h, dj) {
  let v = 0, z = 0, mj = 0;
  if (canshu.yongliaojl) {
    if (c && k && h && dj) {
      z = calzhong_dg(c, k, h)
      v = NP.times(z, parseFloat(dj));
    }
  } else {
    if (c && k && dj) {
      mj = calmianji_dg(c, k)
      v = NP.times(mj, dj);
    }
  }
  return v
}
//n,dj对应数量、单价
export function caljgAmount_dg(n, dj) {
  let v = 0
  if (n && dj) {
    v = NP.times(n, dj);
  }
  return v
}

//计算零件单价lingjianDj_dg
export function callingjianDj_dg(chang_dg, kuan_dg, hou_dg, yldj_dg, jgcd_dg, jgdj_dg, kongshu_dg, kongdj_dg) {
  let a = calclAmount(chang_dg, kuan_dg, hou_dg, yldj_dg);
  let b = caljgAmount_dg(jgcd_dg, jgdj_dg);
  let c = caljgAmount_dg(kongshu_dg, kongdj_dg)
  let v = 0
  if (a && b && c) {
    v = NP.plus(a, b, c);
  }
  return v
}
//计算零件金额ljtotalAmount_dg
export function calljtotalAmount_dg(chang_dg, kuan_dg, hou_dg, yldj_dg, jgcd_dg, jgdj_dg, kongshu_dg, kongdj_dg, lingjiansl_dg) {
  let totaldj = callingjianDj_dg(chang_dg, kuan_dg, hou_dg, yldj_dg, jgcd_dg, jgdj_dg, kongshu_dg, kongdj_dg)
  let v = 0
  if (totaldj && lingjiansl_dg) {
    v = caljgAmount_dg(lingjiansl_dg, totaldj);
  }
  return v
}
//计算实付金额shifuAmount_dg
export function calshifuAmount_dg(chang_dg, kuan_dg, hou_dg, yldj_dg, jgcd_dg, jgdj_dg, kongshu_dg, kongdj_dg, lingjiansl_dg, flzhong_dg, feiliaodj_dg) {
  let totaldj = callingjianDj_dg(chang_dg, kuan_dg, hou_dg, yldj_dg, jgcd_dg, jgdj_dg, kongshu_dg, kongdj_dg)
  let ljAmount_dg = caljgAmount_dg(lingjiansl_dg, totaldj);
  let flAmount_dg = caljgAmount_dg(flzhong_dg, feiliaodj_dg);
  let v = ljAmount_dg - flAmount_dg
  return v
}
//就散大工库存
// 如果单位是平方米，则减去平方，如果单位只kg，则减去重量
//单位unit,库存kc,重量zl,面积mj,长chang_dg,宽kuan_dg,厚hou_dg,零件lingjiansl_dg
export function xssl(unit, chang_dg, kuan_dg, hou_dg, lingjiansl_dg) {
  if (unit == "平方米") {
    return NP.times(chang_dg, kuan_dg) / 1000000 * lingjiansl_dg;
  } else if (unit == "千克") {
    return calzhong_dg(chang_dg, kuan_dg, hou_dg) * lingjiansl_dg;
  }
}
//就散大工库存
// 如果单位是平方米，则减去平方，如果单位只kg，则减去重量
//单位unit,库存total_quantity,长chang_dg,宽kuan_dg,厚hou_dg,零件lingjiansl_dg
function dg_kc(unit, total_quantity, chang_dg, kuan_dg, hou_dg, lingjiansl_dg) {
  let sales_quantity = xssl(unit, chang_dg, kuan_dg, hou_dg, lingjiansl_dg)
  return accSubtr(total_quantity, sales_quantity)
}

export const columns_dagong = [
  {
    title: "序号",
    dataIndex: "index",
    key: "index",
    width: 45,
    align: 'center',
    customRender: (value, item, index) => {
      return item.isTotal ? "合计" : index + 1;
    },
  },
  {
    title: "商品名称",
    dataIndex: "name",
    key: "name",
    width: 80,
    align: 'center',
  },
  {
    title: "规格",
    dataIndex: "guige",
    key: "guige",
    width: 60,
    align: 'center',
  },
  {
    title: '单位',
    dataIndex: 'unit',
    key: 'unit',
    width: 40,
    align: 'center',
  },
  {
    title: '库存',
    dataIndex: 'total_quantity',
    key: 'total_quantity',
    width: 40,
    align: 'center',
    customRender: (value, item) => {
      if (item.isTotal) return value;
      value = dg_kc(item.unit, item.total_quantity, item.chang_dg, item.kuan_dg, item.hou_dg, item.lingjiansl_dg)
      // value =item.clAmount+item.jgAmount;
      return item.id ? NP.round(value, 2) : "";
    },
  },
  {
    title: "用料（长宽厚：mm，重：kg）",
    dataIndex: "clf_dg",
    key: "clf_dg",
    align: 'center',
    children: [
      {
        title: "材料",
        dataIndex: "cailiao_dg",
        key: "cailiao_dg",
        width: 40,
        align: 'center',
        scopedSlots: { customRender: "cailiao_dg" },
      },
      {
        title: "长",
        dataIndex: "chang_dg",
        key: "chang_dg",
        width: 20,
        align: 'center',
        scopedSlots: { customRender: "chang_dg" },
      },
      {
        title: "宽",
        dataIndex: "kuan_dg",
        key: "kuan_dg",
        width: 20,
        align: 'center',
        scopedSlots: { customRender: "kuan_dg" },
      },
      {
        title: "厚",
        dataIndex: "hou_dg",
        key: "hou_dg",
        width: 20,
        align: 'center',
        scopedSlots: { customRender: "hou_dg" },
      },
      {
        title: "重",
        dataIndex: "zhong_dg",
        key: "zhong_dg",
        width: 20,
        align: 'center',
        customRender: (value, item) => {
          if (item.isTotal) return value;
          value = calzhong_dg(item.chang_dg, item.kuan_dg, item.hou_dg);
          return item.id ? NP.round(value, value < 0.09 ? 3 : 2) : "";
        },
        scopedSlots: { customRender: "zhong_dg" },
      },
      {
        title: "面积",
        dataIndex: "mianji_dg",
        key: "mianji_dg",
        width: 20,
        align: 'center',
        customRender: (value, item) => {
          if (item.isTotal) return value;
          value = 0;
          if (item.chang_dg && item.kuan_dg) {
            value = NP.times(item.chang_dg, item.kuan_dg) / 10000;
            item.mianji_dg = value
          }
          return item.id ? NP.round(value, 2) : "";
        },
        scopedSlots: { customRender: "mianji_dg" },
      },
      {
        title: "单价",
        dataIndex: "yldj_dg",
        key: "yldj_dg",
        width: 20,
        align: 'center',
        scopedSlots: { customRender: "yldj_dg" },
      },
      {
        title: "金额",
        dataIndex: "clAmount_dg",
        key: "clAmount_dg",
        width: 40,
        align: 'center',
        customRender: (value, item) => {
          if (item.isTotal) return value;
          value = calclAmount(item.chang_dg, item.kuan_dg, item.hou_dg, item.yldj_dg);
          return item.id ? NP.round(value, 2) : "";
        },
      },
    ],
  },
  {
    title: "加工切割（长：米）",
    dataIndex: "jg_dg",
    key: "jg_dg",
    align: 'center',
    children: [
      {
        title: "长",
        dataIndex: "jgcd_dg",
        key: "jgcd_dg",
        width: 20,
        align: 'center',
        scopedSlots: { customRender: "jgcd_dg" },
      },
      {
        title: "单价",
        dataIndex: "jgdj_dg",
        key: "jgdj_dg",
        width: 20,
        align: 'center',
        scopedSlots: { customRender: "jgdj_dg" },
      },
      {
        title: "金额",
        dataIndex: "jgAmount_dg",
        key: "jgAmount_dg",
        width: 40,
        align: 'center',
        customRender: (value, item) => {
          if (item.isTotal) return value;
          value = caljgAmount_dg(item.jgcd_dg, item.jgdj_dg);
          return item.id ? NP.round(value, 2) : "";
        },
      },
      {
        title: "加工人员",
        dataIndex: "jgry",
        key: "jgry",
        width: 80,
        align: 'center',
        scopedSlots: { customRender: "jgry" },
      },
      {
        title: "分类",
        dataIndex: "jgfl",
        key: "jgfl",
        width: 50,
        align: 'center',
        scopedSlots: { customRender: "jgfl" },
      },
    ]
  },
  {
    title: "孔",
    dataIndex: "kong_dg",
    key: "kong_dg",
    align: 'center',
    children: [
      {
        title: "数量",
        dataIndex: "kongshu_dg",
        key: "kongshu_dg",
        width: 20,
        align: 'center',
        scopedSlots: { customRender: "kongshu_dg" },
      },
      {
        title: "单价",
        dataIndex: "kongdj_dg",
        key: "kongdj_dg",
        width: 20,
        align: 'center',
        scopedSlots: { customRender: "kongdj_dg" },
      },
      {
        title: "金额",
        dataIndex: "kongAmount_dg",
        key: "kongAmount_dg",
        width: 40,
        align: 'center',
        customRender: (value, item) => {
          if (item.isTotal) return value;
          value = caljgAmount_dg(item.kongshu_dg, item.kongdj_dg);
          return item.id ? NP.round(value, 2) : "";
        },
      },
    ]
  },
  {
    title: "零件",
    dataIndex: "kong_dg",
    key: "kong_dg",
    align: 'center',
    children: [
      {
        title: "数量",
        dataIndex: "lingjiansl_dg",
        key: "lingjiansl_dg",
        width: 20,
        align: 'center',
        scopedSlots: { customRender: "lingjiansl_dg" },
      },
      {
        title: "单价",
        dataIndex: "lingjianDj_dg",
        key: "lingjianDj_dg",
        width: 40,
        align: 'center',
        customRender: (value, item) => {
          if (item.isTotal) return value;
          value = callingjianDj_dg(item.chang_dg, item.kuan_dg, item.hou_dg, item.yldj_dg, item.jgcd_dg, item.jgdj_dg, item.kongshu_dg, item.kongdj_dg)
          return item.id ? NP.round(value, 2) : "";
        },
      },
      {
        title: "金额",
        dataIndex: "ljtotalAmount_dg",
        key: "ljtotalAmount_dg",
        width: 40,
        align: 'center',
        customRender: (value, item) => {
          if (item.isTotal) return value;
          value = calljtotalAmount_dg(item.chang_dg, item.kuan_dg, item.hou_dg, item.yldj_dg, item.jgcd_dg, item.jgdj_dg, item.kongshu_dg, item.kongdj_dg, item.lingjiansl_dg)
          return item.id ? NP.round(value, 2) : "";
        },
      },
    ],
  },
  {
    title: "废料(重量：kg)",
    dataIndex: "feiliao_dg",
    key: "feiliao_dg",
    align: 'center',
    children: [
      {
        title: "重量",
        dataIndex: "flzhong_dg",
        key: "flzhong_dg",
        width: 20,
        align: 'center',
        scopedSlots: { customRender: "flzhong_dg" },
      },
      {
        title: "单价",
        dataIndex: "feiliaodj_dg",
        key: "feiliaodj_dg",
        width: 20,
        align: 'center',
        scopedSlots: { customRender: "feiliaodj_dg" },
      },
      {
        title: "金额",
        dataIndex: "feiliaoAmount_dg",
        key: "feiliaoAmount_dg",
        width: 20,
        align: 'center',
        customRender: (value, item) => {
          if (item.isTotal) return value;
          value = caljgAmount_dg(item.flzhong_dg, item.feiliaodj_dg);
          return item.id ? NP.round(value, 2) : "";
        },
      },
    ]
  },
  {
    title: "实付金额",
    dataIndex: "shifuAmount_dg",
    key: "shifuAmount_dg",
    width: 45,
    align: 'center',
    customRender: (value, item) => {
      if (item.isTotal) return value;
      value = calshifuAmount_dg(item.chang_dg, item.kuan_dg, item.hou_dg, item.yldj_dg, item.jgcd_dg, item.jgdj_dg, item.kongshu_dg, item.kongdj_dg, item.lingjiansl_dg, item.flzhong_dg, item.feiliaodj_dg)
      return item.id ? NP.round(value, 2) : "";
    },
  },
  {
    title: "备注",
    dataIndex: "beizhu",
    key: "beizhu",
    width: 60,
    align: 'center',
    scopedSlots: { customRender: "beizhu" },
  },
  {
    title: "操作",
    dataIndex: "action",
    key: "action",
    width: 60,
    align: 'center',
    scopedSlots: { customRender: "action" },
  },
];

export const columns_dagong_detail = [
  {
    title: "序号",
    dataIndex: "index",
    key: "index",
    width: 45,
    align: 'center',
    customRender: (value, item, index) => {
      return item.isTotal ? "合计" : index + 1;
    },
  },
  {
    title: "商品名称",
    dataIndex: "goods_name",
    key: "goods_name",
    width: 70,
    align: 'center',
  },
  {
    title: "用料（长宽厚：mm，重：kg）",
    dataIndex: "clf_dg",
    key: "clf_dg",
    align: 'center',
    children: [
      {
        title: "材料",
        dataIndex: "cailiao_dg",
        key: "cailiao_dg",
        width: 40,
        align: 'center',
        scopedSlots: { customRender: "cailiao_dg" },
      },
      {
        title: "长",
        dataIndex: "chang_dg",
        key: "chang_dg",
        width: 40,
        align: 'center',
        scopedSlots: { customRender: "chang_dg" },
      },
      {
        title: "宽",
        dataIndex: "kuan_dg",
        key: "kuan_dg",
        width: 40,
        align: 'center',
        scopedSlots: { customRender: "kuan_dg" },
      },
      {
        title: "厚",
        dataIndex: "hou_dg",
        key: "hou_dg",
        width: 40,
        align: 'center',
        scopedSlots: { customRender: "hou_dg" },
      },
      {
        title: "重",
        dataIndex: "zhong_dg",
        key: "zhong_dg",
        width: 40,
        align: 'center',
        customRender: (value, item) => {
          if (item.isTotal) return value;
          value = calzhong_dg(item.chang_dg, item.kuan_dg, item.hou_dg);
          return item.id ? NP.round(value, value < 0.09 ? 3 : 2) : "";
        },
        scopedSlots: { customRender: "zhong_dg" },
      },
      {
        title: "面积",
        dataIndex: "mianji_dg",
        key: "mianji_dg",
        width: 40,
        align: 'center',
        customRender: (value, item) => {
          if (item.isTotal) return value;
          value = 0;
          if (item.chang_dg && item.kuan_dg) {
            value = NP.times(item.chang_dg, item.kuan_dg) / 10000;
            item.mianji_dg = value
          }
          return item.id ? NP.round(value, 2) : "";
        },
        scopedSlots: { customRender: "mianji_dg" },
      },
      {
        title: "单价",
        dataIndex: "yldj_dg",
        key: "yldj_dg",
        width: 40,
        align: 'center',
        scopedSlots: { customRender: "yldj_dg" },
      },
      {
        title: "金额",
        dataIndex: "clAmount_dg",
        key: "clAmount_dg",
        width: 60,
        align: 'center',
        customRender: (value, item) => {
          if (item.isTotal) return value;
          value = calclAmount(item.chang_dg, item.kuan_dg, item.hou_dg, item.yldj_dg);
          return item.id ? NP.round(value, 2) : "";
        },
      },
    ],
  },
  {
    title: "切割(长:米)",
    dataIndex: "jg_dg",
    key: "jg_dg",
    align: 'center',
    children: [
      {
        title: "长",
        dataIndex: "jgcd_dg",
        key: "jgcd_dg",
        width: 35,
        align: 'center',
        scopedSlots: { customRender: "jgcd_dg" },
      },
      {
        title: "单价",
        dataIndex: "jgdj_dg",
        key: "jgdj_dg",
        width: 35,
        align: 'center',
        scopedSlots: { customRender: "jgdj_dg" },
      },
      {
        title: "金额",
        dataIndex: "jgAmount_dg",
        key: "jgAmount_dg",
        width: 40,
        align: 'center',
        customRender: (value, item) => {
          if (item.isTotal) return value;
          value = caljgAmount_dg(item.jgcd_dg, item.jgdj_dg);
          return item.id ? NP.round(value, 2) : "";
        },
      },
    ]
  },
  {
    title: "孔",
    dataIndex: "kong_dg",
    key: "kong_dg",
    align: 'center',
    children: [
      {
        title: "数量",
        dataIndex: "kongshu_dg",
        key: "kongshu_dg",
        width: 35,
        align: 'center',
        scopedSlots: { customRender: "kongshu_dg" },
      },
      {
        title: "单价",
        dataIndex: "kongdj_dg",
        key: "kongdj_dg",
        width: 35,
        align: 'center',
        scopedSlots: { customRender: "kongdj_dg" },
      },
      {
        title: "金额",
        dataIndex: "kongAmount_dg",
        key: "kongAmount_dg",
        width: 35,
        align: 'center',
        customRender: (value, item) => {
          if (item.isTotal) return value;
          value = caljgAmount_dg(item.kongshu_dg, item.kongdj_dg);
          return item.id ? NP.round(value, 2) : "";
        },
      },
    ]
  },
  {
    title: "零件",
    dataIndex: "kong_dg",
    key: "kong_dg",
    align: 'center',
    children: [
      {
        title: "数量",
        dataIndex: "lingjiansl_dg",
        key: "lingjiansl_dg",
        width: 40,
        align: 'center',
        scopedSlots: { customRender: "lingjiansl_dg" },
      },
      {
        title: "单价",
        dataIndex: "lingjianDj_dg",
        key: "lingjianDj_dg",
        width: 40,
        align: 'center',
        customRender: (value, item) => {
          if (item.isTotal) return value;
          value = callingjianDj_dg(item.chang_dg, item.kuan_dg, item.hou_dg, item.yldj_dg, item.jgcd_dg, item.jgdj_dg, item.kongshu_dg, item.kongdj_dg)
          return item.id ? NP.round(value, 2) : "";
        },
      },
      {
        title: "金额",
        dataIndex: "ljtotalAmount_dg",
        key: "ljtotalAmount_dg",
        width: 60,
        align: 'center',
        customRender: (value, item) => {
          if (item.isTotal) return value;
          value = calljtotalAmount_dg(item.chang_dg, item.kuan_dg, item.hou_dg, item.yldj_dg, item.jgcd_dg, item.jgdj_dg, item.kongshu_dg, item.kongdj_dg, item.lingjiansl_dg)
          return item.id ? NP.round(value, 2) : "";
        },
      },
    ],
  },
  {
    title: "废料(重量：kg)",
    dataIndex: "feiliao_dg",
    key: "feiliao_dg",
    align: 'center',
    children: [
      {
        title: "重量",
        dataIndex: "flzhong_dg",
        key: "flzhong_dg",
        width: 35,
        align: 'center',
        scopedSlots: { customRender: "flzhong_dg" },
      },
      {
        title: "单价",
        dataIndex: "feiliaodj_dg",
        key: "feiliaodj_dg",
        width: 35,
        align: 'center',
        scopedSlots: { customRender: "feiliaodj_dg" },
      },
      {
        title: "金额",
        dataIndex: "feiliaoAmount_dg",
        key: "feiliaoAmount_dg",
        width: 60,
        align: 'center',
        customRender: (value, item) => {
          if (item.isTotal) return value;
          value = caljgAmount_dg(item.flzhong_dg, item.feiliaodj_dg);
          return item.id ? NP.round(value, 2) : "";
        },
      },
    ]
  },
  {
    title: "实付金额",
    dataIndex: "shifuAmount_dg",
    key: "shifuAmount_dg",
    width: 60,
    align: 'center',
    customRender: (value, item) => {
      if (item.isTotal) return value;
      value = calshifuAmount_dg(item.chang_dg, item.kuan_dg, item.hou_dg, item.yldj_dg, item.jgcd_dg, item.jgdj_dg, item.kongshu_dg, item.kongdj_dg, item.lingjiansl_dg, item.flzhong_dg, item.feiliaodj_dg)
      return item.id ? NP.round(value, 2) : "";
    },
  },
];

export const rules = {
  number: [{ required: true, message: "请输入编号", trigger: "change" }],
  warehouse: [{ required: true, message: "请选择仓库", trigger: "change" }],
  client: [{ required: true, message: "请选择客户", trigger: "change" }],
  handler: [{ required: true, message: "请选择经手人", trigger: "change" }],
  handle_time: [{ required: true, message: "请选择处理日期", trigger: "change" }],
  other_amount: [
    { pattern: new RegExp(/^\d{0,14}(?:\.\d{0,2})?$/), message: "其他费用格式不正确", trigger: "change" },
  ],
};

export const columnsAccount = [
  {
    title: "序号",
    dataIndex: "index",
    key: "index",
    width: 45,
    customRender: (value, item, index) => {
      return item.isTotal ? "合计" : index + 1;
    },
  },
  {
    title: "结算账户",
    dataIndex: "account",
    key: "account",
    width: 200,
    scopedSlots: { customRender: "account" },
  },
  {
    title: "收款金额",
    dataIndex: "collection_amount",
    key: "collection_amount",
    width: 200,
    scopedSlots: { customRender: "collection_amount" },
  },
  {
    title: "操作",
    dataIndex: "action",
    key: "action",
    width: 80,
    scopedSlots: { customRender: "action" },
  },
];